//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

using System;

namespace Microsoft.Research.DataLayer.ServiceModel
{
    /// <summary>
    /// Respresents a node in the tree veiw
    /// </summary>
    [Serializable]
    public class JobDetails
    {
        private string jobName;
        private Guid jobId;
        private string errormessage;
        private bool isdeleted;
        private string notes;
        private JobStatus status;

        public JobDetails(Job job)
        {
            this.JobId = (job as IObject).ID;
            this.JobName = job.Name;
            this.Notes = job.Notes;
            this.Isdeleted = job.IsDeleted;
            this.ErrorMessage = job.ErrorMessage;
            this.Status = (JobStatus)Enum.Parse(typeof(JobStatus), job.Status.ToString(), false);
        }

        public Guid JobId
        {
            get
            {
                return jobId;
            }
            set
            {
                jobId = value;
            }
        }

        public string JobName
        {
            get
            {
                return jobName;
            }
            set
            {
                jobName = value;
            }
        }

        public string ErrorMessage
        {
            get
            {
                return errormessage;
            }
            set
            {
                errormessage = value;
            }
        }

        public bool Isdeleted
        {
            get
            {
                return isdeleted;
            }
            set
            {
                isdeleted = value;
            }
        }

        public string Notes
        {
            get
            {
                return notes;
            }
            set
            {
                notes = value;
            }
        }

        public JobStatus Status
        {
            get
            {
                return status;
            }
            set
            {
                status = value;
            }
        }
    }

    public enum JobStatus
    {
        NotStarted,
        Initializing,
        Running,
        Paused,
        Waiting,
        Completed,
        Aborted,
        StartPending,
        StopPending,
        PausePending,
        ResumePending,
    }

}
